# _*_ coding:utf-8 _*_
# at:2024-07-21
# author:zizle

import json
with open('222.json', 'r', encoding='utf8') as f:
    lines = f.readlines()

u = '61813eafed3a9600019c960e'
with open('333.json', 'a+', encoding='utf8') as f2:

    for ln in lines:
        d = json.loads(ln)
        if d['user_id']['$oid'] != u:
            continue
        # if not d['category']:
        #     print(d)
        js = {
            '_id': d['_id']['$oid'],
            'user_id': d['user_id']['$oid'],
            'bill_time': d['bill_time'],
            'bill_name': d['account_name'],
            'ledger_id': d['category']['$oid'] if d['category'] else '6181e5387d29390001643a65',
            'money': d['money'],
            'note': d['description']

        }
        f2.write(json.dumps(js) + '\n')

